PNAME=chess

CC=g++
CFLAGS=-Wall -g -I$(IDIR)

IDIR =inc
SDIR=src
ODIR=obj
LDIR =lib

LIBS=-lm

_DEPS = Point.h Board.h
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))

_OBJ = main.o Point.o Board.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))

default:
	reset
	@make $(PNAME) --no-print-directory
	./chess

$(OBJ): $(ODIR)/%.o: $(SDIR)/%.cpp $(DEPS)
	$(CC) -c -o $@ $< $(CFLAGS)

$(PNAME): $(OBJ)
	$(CC) -o $@ $^ $(CFLAGS) $(LIBS)

.PHONY: clean

clean:
	rm -f $(ODIR)/*.o *~ core $(IDIR)/*~
